package com.gof.example.composite.safe_component;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/6 19:00.
 * haiming.fei@tongdun.cn
 */
public class Window implements SafeComponent {

    private List<SafeComponent> cs = new ArrayList<>();

    public void addComponent(SafeComponent c) {
        cs.add(c);
    }

    @Override
    public void refresh() {
        System.out.println("refresh Window");

        for (SafeComponent c : cs) {
            c.refresh();
        }
    }
}
